package com.idlestar.androiddocs.common;

import android.app.Application;
import android.os.Handler;

/**
 * Created by admin on 2016/8/18.
 */
public class MyApp extends Application {
    private static MyApp sMyApp;
    private Handler mHandler = new Handler();

    @Override
    public void onCreate() {
        super.onCreate();

        sMyApp = this;
    }

    public static MyApp instance() {
        return sMyApp;
    }

    public void runOnUiThread(Runnable action) {
        mHandler.post(action);
    }

    public void runOnUiThread(Runnable action, long delayMillis) {
        mHandler.postDelayed(action, delayMillis);
    }
}
